using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UwinEducation.Domain.Entities;
using UwinEducation.Shared.Models;

namespace UwinEducation.Domain.IRepositories
{
    public interface IRoleRepository : IRepository<Role, Guid>
    {
        /// <summary>
        /// 分页查询角色列表
        /// </summary>
        /// <param name="pageRequest">分页参数</param>
        /// <returns>分页结果</returns>
        Task<PagedResult<Role>> GetPagedListAsync(PageRequest pageRequest);

        /// <summary>
        /// 根据ID获取角色
        /// </summary>
        /// <param name="id">角色ID</param>
        /// <returns>角色实体</returns>
        new Task<Role> GetByIdAsync(Guid id);

        /// <summary>
        /// 创建角色
        /// </summary>
        /// <param name="role">角色实体</param>
        Task CreateAsync(Role role);

        /// <summary>
        /// 更新角色
        /// </summary>
        /// <param name="role">角色实体</param>
        Task UpdateAsync(Role role);

        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="id">角色ID</param>
        new Task DeleteAsync(Guid id);

        /// <summary>
        /// 为角色分配菜单权限
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="menuCodes">菜单code列表</param>
        Task AssignMenusAsync(Guid roleId, List<string> menuCodes);


        /// <summary>
        /// 检查角色名是否已存在
        /// </summary>
        /// <param name="name"></param>
        /// <param name="excludeId"></param>
        /// <returns></returns>
        Task<bool> ExistsByNameAsync(string name, Guid? excludeId = null);
    }
}